package cn.youframe.sample.transaction;

import cn.youframe.frame.base.BaseServiceImpl;
import cn.youframe.frame.exception.AppException;

/**
 * User: Administrator
 * DateTime: 12-7-23 下午10:28
 * Desc:
 */
public class TransactionServiceImpl extends BaseServiceImpl implements TransactionService {
    TransactionDao transactionDao;
    TransactionOraDao transactionOraDao;

    @Override
    public Object insertGetKeyOra() {
        return transactionOraDao.insertGetKey();
    }

    public TransactionOraDao getTransactionOraDao() {
        return transactionOraDao;
    }

    public void setTransactionOraDao(TransactionOraDao transactionOraDao) {
        this.transactionOraDao = transactionOraDao;
    }

    public TransactionDao getTransactionDao() {
        return transactionDao;
    }

    public void setTransactionDao(TransactionDao transactionDao) {
        this.transactionDao = transactionDao;
    }

    @Override
    public Object insertGetKey() {
        Object obj=null;
        try{
            obj=transactionDao.insertGetKey();
        }catch (Exception e){
            logger.error(e.getMessage(),e);
        }
        return obj;
    }

    @Override

    public int doMenu(String memo) {
        try{
            transactionDao.updateMenu("2000","事务菜单修改");
            transactionDao.deleteMenu("1131");
            transactionDao.addMenu("2000","事务菜单");
        }catch (Exception e){
            throw new AppException(e,"执行异常："+e.getMessage());
        }
        return 0;
    }
}
